﻿using EasyGameTemplate;
using Framework.Audio;
using Framework.Timer;
using UnityEngine;

public class LightController : GamePoolAbstract
{

    public float   Time;
    public float   MaxValue;
    public Light[] Lights;

    public void CloseLight() { this.SetLight(0); }

    public void OpenLight()
    {
        GameUpdateMgr.Instance.CreateTimer(this.Time, () => { this.SetLight(this.MaxValue); }, f => { this.SetLight(f * this.MaxValue); });
    }

    public void SetLight(float value)
    {
        foreach (var light1 in this.Lights)
        {
            light1.intensity = value;
        }
    }

}